<template>
  <div class="all" ref="ActiveYear4">
    
    <div class="bg" v-if="reportFourthJson">
      <LImage class="img-bg" :src="Config.img('2201_bg.png')"></LImage>
      <div class="allab">
        <LImage class="img-stars" :src="Config.img('2201_stars.png')"></LImage>
      </div>
      <LImage class="img-spot-left" :src="Config.img('2201_left_spot.png')"></LImage>
      <LImage class="img-spot-right" :src="Config.img('2201_right_spot.png')"></LImage>
      <LImage class="img-log" :src="Config.img('2201_page4_logo.png')"></LImage>
      
      <div class="height40"></div>
      <div class="height60" v-if="!(reportFourthJson.time > 0)"></div>
      <template v-if="reportFourthJson.isContract">
        <richtext class="richtext" :style="{'background-color':stylek}">
          <span class="font30 text1">{{'都说'}}</span>
          <span class="font30 text-yellow">{{'“新手败于追高，老手败于抄底，'}}</span>
        </richtext>
        <div class="height10"></div>
        <text class="font30 text-yellow">{{'高手败于杠杆”'}}</text>

        <div class="height40"></div>
        <text class="font30 text1">{{'而你不打无准备之仗，总是满仓杀入'}}</text>
      </template>
      <template v-else>
        <text class="font30 text1">{{'你的性格似乎有些倔强，'}}</text>
        <div class="height10"></div>
        <text class="font30 text1">{{'总是死扛不止损'}}</text>
        
        <div class="height40"></div>
        <richtext class="richtext" :style="{'background-color':stylek}">
          <span class="font30 text1">{{'这一年，你'}}</span>
          <span class="font52 text-yellow">{{reportFourthJson.count}}</span>
          <span class="font30 text1">{{'次拍断大腿。'}}</span>
        </richtext>
        <div class="height10"></div>
        <text class="font30 text1">{{'还好，利润都在，就是本金没了'}}</text>
      </template>

      <div class="height40"></div>
      <template v-if="reportFourthJson.time > 0">

        <richtext class="richtext" :style="{'background-color':stylek}">
          <span class="font30 text-yellow">{{reportFourthJson.m}}</span>
          <span class="font30 text1">{{'月'}}</span>
          <span class="font30 text-yellow">{{reportFourthJson.d}}</span>
          <span class="font30 text1">{{'日，你似乎遇到了一点小挫折，'}}</span>
        </richtext>
        <div class="height10"></div>
        <richtext class="richtext" :style="{'background-color':stylek}">
          <span class="font30 text1">{{'你的策略收益为'}}</span>
          <span class="font52 text-yellow">{{reportFourthJson.lowerEarningRate}}</span>
          <span class="font30 text-yellow">{{'%'}}</span>
        </richtext>

        <div class="height40"></div>
        <richtext class="richtext" v-if="reportFourthJson.isContract">
          <span class="font30 text1">{{'你始终坚信：'}}</span>
          <span class="font30 text-yellow">{{'“'+reportFourthJson.dd+'军永不为奴”'}}</span>
        </richtext>
        <richtext v-else class="richtext">
          <span class="font30 text1">{{'你始终坚信：'}}</span>
          <span class="font30 text-yellow">{{'瀑布算个球，富贵险中求'}}</span>
        </richtext>

        <richtext class="richtext" :style="{'background-color':stylek}">
          <span class="font30 text1">{{'最终扭亏为盈，赚取收益'}}</span>
          <span class="font52 text-yellow">{{'+'+reportFourthJson.realEarningRate}}</span>
          <span class="font30 text-yellow">{{'%'}}</span>
        </richtext>
      </template>

      <div class="all"></div>
      <div class="but" @stopPropagation="stopPropagation" @click="otClick"></div>
    </div>
  </div>
</template>

<style src="@/_css/style.css" ></style>
<style scoped>
  .richtext {
    background-color:rgba(0, 0, 0, 0)
  }
  .yinyue {
    position: absolute;
    right: 40;
    top: 40;
    width: 60px;
    height: 60px;
  }
  .text1 {
    color: #E5F3FF;
  }
  .bg {
    overflow: hidden;
    flex: 1;
    padding-left: 70px;
    padding-right: 70px;
  }
  .allab {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: center;
    align-items: center;
  }
  .img-bg {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
  }
  .img-stars {
    width: 719px;
    height: 766px;
  }
  .img-spot-left {
    position: absolute;
    bottom: 380;
    left: 10;

    width: 88px;
    height: 93px;
  }
  .img-spot-right {
    position: absolute;
    bottom: 288;
    right: 0;
    
    width: 147px;
    height: 155px;
  }
  .img-log {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 750px;
    height: 752px;
  }

  .img-text {
    width: 296px;
    height: 119px;
    margin-top: 40px;
  }
  .but {
    height: 160px;
  }
  .mb40 {
    margin-bottom: 40px;
  }
  .text-yellow {
    color: #F6CF54;
  }
</style>

<script>

//功能
import jconfig from "@/_js/config"; 
import jmath from "@/_js/math"; 
import jtime from "@/_js/time"; 

export default {
  props:{
    data:{
      type:Object,
      default:undefined,
    },
  },

  data() {
    return {
      Config: jconfig,
      data:undefined,
      reportFourthJson:undefined,
    }
  },

  /* reportFourthJson 4
    * 
    *   isContract true 合约
    *   lowerEarningRate 中间收益率
    *   realEarningRate 最后收益率
    *   count 次数
    *   time 时间
    *     "reportFourthJson":{
            "isContract":true,
            "lastEarning":0,
            "count":0,
            "time":0,
            "lastRealEarning":0
        },
    **/
  mounted(){
    var reportFourthJson = this.data.reportFourthJson;
    if (reportFourthJson.time > 0) {
      reportFourthJson.m = jtime.getTime(reportFourthJson.time, 'M');
      reportFourthJson.d = jtime.getTime(reportFourthJson.time, 'd');
      if (reportFourthJson.longShort == 0) {
        reportFourthJson.dd = '空'
      } else if (reportFourthJson.longShort == 1) {
        reportFourthJson.dd =  '多';
      } else {
        reportFourthJson.dd =  '多';
      }
   }
    this.reportFourthJson = reportFourthJson;
    setTimeout(() => {
      this.stylek = 'rgba(0, 0, 0, 0)';
      this.$forceUpdate();
    }, 1000);
  },

  methods:{
    
    /******************** 手势*/
    stopPropagation(){
      return true;
    },

    /******************** 按钮*/
    //查看
    otClick() {
      this.$emit("ot", this.$refs.ActiveYear4, 5);
    },
  }
}
</script>
